<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
		<link rel="shortcut icon" href="favicon.ico">
		<link rel="stylesheet" href="css/iconfont.css">
		<link rel="stylesheet" href="css/global.css">
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link rel="stylesheet" href="css/bootstrap-theme.min.css">
		<link rel="stylesheet" href="css/swiper.min.css">
		<link rel="stylesheet" href="css/styles.css">
		<link rel="stylesheet" href="css/logo.css" />
		<script src="js/jquery.1.12.4.min.js" charset="UTF-8"></script>
		<script src="js/bootstrap.min.js" charset="UTF-8"></script>
		<script src="js/swiper.min.js" charset="UTF-8"></script>
		<script src="js/global.js" charset="UTF-8"></script>
		<script src="js/jquery.DJMask.2.1.1.js" charset="UTF-8"></script>
	    <script src="js/index2.js"></script> 
	    <link rel="stylesheet" type="text/css" href="css/center.css">
	<!--
    	作者：L
    	时间：2021-12-12
    	描述：js 下拉框
    -->
		<script src="js/jquery.DJMask.2.1.1.js" charset="UTF-8"></script>
	<script src="js/index2.js"></script> 
	<link rel="stylesheet" type="text/css" href="css/center.css">
	 <script type="text/javascript">
		$(function(){//第一步都得写这个
			$(document).on("click",".centers_listm_one_in",function(){
			$(this).next(".gjszmdm").slideToggle().siblings("gjszmdm").slideUp()
			});
		})
	
			/*$(document).ready(function(){ $('.to-top').toTop({position:false}) });*/
		</script>
</head>
<body>
	<!-- 顶部tab -->
	<div id="dingdan"></div>
	<!-- 顶部标题 -->
	<div class="bgf5 clearfix">
			<div class="top-user">
				<div class="inner">
					<a class="logo" href="index.html"><li id="logo"></li></a>
					<div class="title">个人中心</div>
				</div>
			</div>
		</div>

	<div class="content clearfix bgf5">
		<section class="user-center inner clearfix">
			<div class="pull-left bgf">
				<div id="caidan" style="position: absolute;">
            	
            </div>
			<div class="pull-right" id="sppj" style="    left: 350px;
    position: absolute;">
				<div class="user-content__box clearfix bgf">
					<div class="title">订单中心-商品评价</div>
					<div class="evaluate_box">
						
						<div class="evaluate_info posr clearfix" id="sppj" onclick="sppj()" >
							<div class="img"><img src="images/temp/M-001.jpg" alt="" class="cover"></div>
							<div class="name ep2">峥嵘 原创设计 传统日常汉服男绣花唐制圆领袍春秋非古装 峥嵘 原创设计 传统日常汉服男绣花唐制圆领袍春秋非古装</div>
							<div class="param">
								<div class="param-row"><span class="param-label">价格</span><b class="cr fz24">18.00</b><span class="cr">元</span></div>
								<div class="param-row"><span class="param-label">销量</span><span class="c6 fz20">1688</span></div>
								<div class="param-row"><span class="param-label">评价</span><span class="c6 fz20">1688</span></div>
								<div class="param-row"><span class="param-label">好评率</span><span class="c6 fz20">95.87%</span></div>
							</div>
							<div class="info c6">
								颜色分类：深棕色<br> 
								尺码：均码<br>
								现在查看的是您所购商品的信息 于2017年08月11日 20:31下单购买了此商品
							</div>
						</div>
					</div>
					<p class="fz18 cr">商品评价</p>
					
					<div class="modify_div">
						<form action="" class="evaluate-form__box">
							<span class="help-block">快评论一番，让其他买家开开眼</span>
							<table class="table table-bordered" >
								<tr>
									<th scope="row">评价等级</th>
									<td class="user-form-group fz0">
										<label class="labal" onclick="a(this)">
											<input name="opinion" value="G" checked="" type="radio" >
											<i class="iconfont icon-radio"></i> 
											<span> 好评</span>
											</label>
										<label class="labal"  onclick="a(this)">
											<input name="opinion" value="N" type="radio">
											<i class="iconfont icon-radio">
											</i>
											 <span>中评</span></label>
										<label class="labal"  onclick="a(this)">
											<input name="opinion" value="B" type="radio">
											<i class="iconfont icon-radio"></i> 
											<span>差评</span>
										</label>
									</td>
								</tr>
								<tr>
									<th scope="row">评价商品</th>
									<td><textarea rows="5" placeholder="请输入您对该商品的评价~"id="evaluationcommodity"></textarea></td>
								</tr>
								<!-- <tr valign="middle">
									<th scope="row">晒图片</th>
									<td>
										<ul class="uploader__files"></ul>
										<div class="uploader__input"></div>
										<div class="uploader__size"><span class="cr">0</span>/5</div>
									</td>
								</tr> -->
							</table>
							<div class="checkbox">
								<label><!-- <input type="checkbox"><i></i> 匿名评价</a> --></label>
								<button onclick="comment()" type="submit" class="but pull-right">提交评价</button>
							</div>
							
						</form>
					</div>
				</div>
			</div>
		</section>
	</div>
	<!-- 右侧菜单 -->
	<div class="right-nav">
		<ul class="r-with-gotop">
			<li class="r-toolbar-item">
				<a href="udai_welcome.html" class="r-item-hd">
					<i class="iconfont icon-user" data-badge="0"></i>
					<div class="r-tip__box"><span class="r-tip-text">用户中心</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="udai_shopcart.html" class="r-item-hd">
					<i class="iconfont icon-cart"></i>
					<div class="r-tip__box"><span class="r-tip-text">购物车</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="udai_collection.html" class="r-item-hd">
					<i class="iconfont icon-aixin"></i>
					<div class="r-tip__box"><span class="r-tip-text">我的收藏</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="" class="r-item-hd">
					<i class="iconfont icon-liaotian"></i>
					<div class="r-tip__box"><span class="r-tip-text">联系客服</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="issues.html" class="r-item-hd">
					<i class="iconfont icon-liuyan"></i>
					<div class="r-tip__box"><span class="r-tip-text">留言反馈</span></div>
				</a>
			</li>
			<li class="r-toolbar-item to-top">
				<i class="iconfont icon-top"></i>
				<div class="r-tip__box"><span class="r-tip-text">返回顶部</span></div>
			</li>
		</ul>
		<script>
			$(document).ready(function(){ $('.to-top').toTop({position:false}) });
		</script>
	</div>
	
</body>
<script>
	//菜单
	memu ();
	function memu ()
	{
	
		var list = "";
		$.ajax({
		    type: "post",//请求方式
		    url: "http://localhost:16111/user/MenuSelect",//上s层的路径
			dataType: "json",
		    data:{},//传值
		    xhrFields:{withCredentials: true},
		    success: function (data)
			{
				var user = eval('(' + JSON.stringify(data.data) + ')');
				
				
				list += '<div class=\"centers_listm_one\">'+
            	'<img src=\"images/zshy.png\"/>'+
                '<a href='+user.memu_url+'><em>'+user.memu_name+'</em></a>'+
            	'</div>';
            	for(var i in user.childMemu)
            	{
            		
            		list +='<div class=\"centers_listm_one_in\">'+
                '<img src=\"images/kouw.png\"/>'+
                '<em>'+user.childMemu[i].memu_name+'</em>'+
                '<b></b>'+
            	'</div>'+
            	'<span class="gjszmdm">';
            		for(var x in user.childMemu[i].childMemu)
            		{
            			if(user.childMemu[i].childMemu[x].memu_name=="宝贝收藏")
            			{
            				list += 
		                '<a href='+user.childMemu[i].childMemu[x].memu_url+'?userid='+sessionStorage.getItem("userid")+' class=\"center_in_self\"  target =\"_blank\"><font>'+user.childMemu[i].childMemu[x].memu_name+'</font></a>';
            			}else if(user.childMemu[i].childMemu[x].memu_name=="我的足迹")
            			{ 	
            				list += 
		                '<a href='+user.childMemu[i].childMemu[x].memu_url+'?userid='+sessionStorage.getItem("userid")+' class=\"center_in_self\" target =\"_blank\"><font>'+user.childMemu[i].childMemu[x].memu_name+'</font></a>';
            			}else 
            			{
            				list += 
		                '<a href='+user.childMemu[i].childMemu[x].memu_url+' class=\"center_in_self\"><font>'+user.childMemu[i].childMemu[x].memu_name+'</font></a>';
            			}
            			
		            	
            		}
            		list+='</span>';
            	} 
            	
            	$("#caidan").html(list);
		   }
		})		
		
	}
</script>
<script>
								$(document).ready(function(){
									var tmpl = '<li class="uploader__file"><input name="i[]" accept="image/*" type="file"><i>&times;</i></li>',
										$uploader_files = $('.uploader__files'),
										$uploader_input = $('.uploader__input'),
										$uploader_size = $('.uploader__size span');
									$uploader_input.on('click',function() {
										var size = $uploader_files.find('li').length;
										if (size >= 5) {return DJMask.msg("最多上传5张图片！");}
										var $input = $(tmpl);
										$uploader_files.append($input);
										$uploader_size.html(size + 1);
										$input.on('click','i',function() {
											$(this).parent().remove();
											$uploader_size.html($uploader_files.find('li').length);
										});
										$input.on('change','input',function(e) {
											var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files, that = this;
											for (var i = 0, len = files.length; i < len; ++i) {
												var file = files[i];
												if (url) {
													src = url.createObjectURL(file);
												} else {
													src = e.target.result;
												}
												$input.css({'background-image':'url('+src+')'}).addClass('active');
											}
										});
										$input.find('input').click();
									})
								});
							</script>
							
							
<script> 
function getCookie(cookieName) {
    var strCookie = document.cookie;
    var arrCookie = strCookie.split("; ");
    for(var i = 0; i < arrCookie.length; i++){
        var arr = arrCookie[i].split("=");
        if(cookieName == arr[0]){
            return arr[1];
        }
    }
    return "";
}
var userid=getCookie("userid");
var orderid1=localStorage.getItem("orderid");
var spid=localStorage.getItem("spid");

var plc="";
var plc2="";
var plc3="";
var arr = new Array();

function traverse(date) {
	//			alert(123);
	console.log(date);
	for(var i in date) {
		if(typeof(date[i]) == "object") {
			traverse(date[i]);

		} else {
			//			console.log(i + "=" + date[i]); //如果是值就显示
			arr.push(date[i]);
		}
	}

}
sppj();
	
	function pinlcha(){
//		alert(2);
//		alert("userid=="+userid);
//		alert("spid==="+spid);
		$.ajax({
			mimeType: "post",
			url:"http://localhost:16111/orderform/commentsS",
			dataType: "json",
			data:{
					userid:userid,
					spid:spid,
			},
			xhrFields:{withCredentials: true},
			success:function(date){
				localStorage.setItem("oneID",0);
//				alert("date====="+date);
				if(date!=""){
//					alert(111);
					for(i in date){
//						alert("232"+date[i].id);
					localStorage.setItem("oneID",date[i].id);
					var time1 = new Date(date[i].comment_time);
					var time2 = time1.getFullYear()+"-"+time1.getMonth()+"-"+time1.getDay()+"&nbsp;&nbsp;"+time1.getHours()+":"+time1.getMinutes()+":"+time1.getSeconds();
					plc+="<div class='wei'>"+
					"<span>评价：</span>"+
//					"<span>等级：</span>"+
					"<span>"+date[i].comment_content+"</span>"+
					"<p>"+time2+"</p>"+
					"</div>";
					}
					plc2+=plc;
					pinlcha2();
				}else{
//					alert("jjjj");
					pingjiacha();
				}
			
				
			},
			
		});
	}

	
	function pinlcha2(){
//		alert(3);
		
		$.ajax({
			mimeType: "post",
			url:"http://localhost:16111/orderform/commentsS2",
			dataType: "json",
			data:{
					userid:userid,
					spid:spid,
			},
			xhrFields:{withCredentials: true},
			success:function(date){
				if(date!=null){
					for(i in date){
					
					var time3 = new Date(date[i].comment_time);
					var time4 = time3.getFullYear()+"-"+time3.getMonth()+"-"+time3.getDay()+"&nbsp;&nbsp;"+time3.getHours()+":"+time3.getMinutes()+":"+time3.getSeconds();
					plc2+="<div class='wei'>"+
					"<span>评价：</span>"+
//					"<span>等级：</span>"+
					"<span>"+date[i].reply_content+"</span>"+
					"<p>"+time4+"</p>"+
					"</div>";
					}
					plc3+=plc2;
				}
				
			pingjiacha();
			
				
			},
		});
	}
	function pingjiacha(){
//		alert("oo");
		$.ajax({
				url:"http://localhost:16111/orderform/evaorderxq",
				mimeType: "post",
				dataType: "json",
				data:{
					orderid:orderid1,
				},
				xhrFields:{withCredentials: true},
				success:function(date){
					var str="";
					console.log(date);
					// for(i in date){
//						 alert(date);
						var time1 = new Date(date.undertime);
						var time2 = time1.getFullYear()+"-"+time1.getMonth()+"-"+time1.getDay()
						var str="";
						
						
						// alert(date[i].ordernumber);
					str= "<div class='evaluate_info posr clearfix' id='sppj' onclick='sppj()'>"+
							"<div class='img'><img src="+ date.comitypicture +" alt='' class='cover'></div>"+
							"<div class='name ep2'>llll"+date.comitydescription+"</div>"+
							"<div class='param'>"+
								"<div class='param-row'><span class='param-label'>价格</span><b class='cr fz24'>"+date.comityprices+"</b><span class='cr'>元</span></div>"+
								"<div class='param-row'><span class='param-label'>销量</span><span class='c6 fz20'>"+1688+"</span></div>"+
								"<div class='param-row'><span class='param-label'>评价</span><span class='c6 fz20'>"+1688+"</span></div>"+
								"<div class='param-row'><span class='param-label'>好评率</span><span class='c6 fz20'>"+95.87+"</span></div>"+
							"</div>"+
							"<div class='info c6'>"+
							"<span>	颜色/尺码："+date.specifications+"<br></span>"+ 
							
							"<span>	现在查看的是您所购商品的信息 于"+time2+"下单购买了此商品</span>"+
							"</div>"+
						"</div>"+
						"<p class='fz18 cr'>商品评价</p>"+
						
						"<div class='modify_div1' style='height: 306px;overflow: auto;'><p style='font-size: 20px;'>历史评价</p>"+plc3+"</div>"+
						
						
						
						"<div class='modify_div' style='height: 306px;'>"+
							"<form action='' class='evaluate-form__box'>"+
								"<span class='help-block'>快评论一番，让其他买家开开眼</span>"+
								"<table class='table table-bordered' >"+
									"<tr>"+
										"<th scope='row'>评价等级</th>"+
										"<td class='user-form-group fz0'>"+
											"<label class='labal' onclick='a(this)'>"+
												"<input name='opinion' value='G' checked='' type='radio' >"+
												"<i class='iconfont icon-radio'></i>" +
												"<span> 好评</span>"+
												"</label>"+
											"<label class='labal'  onclick='a(this)'>"+
												"<input name='opinion' value='N' type='radio'>"+
												"<i class='iconfont icon-radio'>"+
												"</i>"+
												 "<span>中评</span></label>"+
											"<label class='labal'  onclick='a(this)'>"+
												"<input name='opinion' value='B' type='radio'>"+
												"<i class='iconfont icon-radio'></i> "+
												"<span>差评</span>"+
											"</label>"+
										"</td>"+
									"</tr>"+
									"<tr>"+
										"<th scope=row>评价商品</th>"+
										"<td><textarea rows='5' placeholder='请输入您对该商品的评价~'id='evaluationcommodity'></textarea></td>"+
									"</tr>"+
									
								"</table>"+
								"<div class='checkbox'>"+
									
									"<button onclick='comment()' type='submit' class='but pull-right'>提交评价</button>"+
								"</div>"+
								
							"</form>"+
						"</div>";
					// }
					
					document.getElementById("sppj").innerHTML = str;
				
				},
			});
	}
	function sppj(){
		
//		alert(1);
//		pinlcha2();
		pinlcha();

		
		
		}
		

	var yi="好评";
	function a(t){
		// alert(t);
		var zhi =t.getElementsByTagName("span");
		
		
		yi=zhi[0].innerHTML;
		// alert(yi)
	}
		function comment(){
			
//			var plid=localStorage.getItem("piid");
			var oneID=localStorage.getItem("oneID");
			var jibie="";
			if(plc2==""){
				jibie="一级";
				oneID=0;
			}
//			alert(plid);
			
			var evaluationcommodity=document.getElementById("evaluationcommodity").value;
//			alert(userid+"==userid");
//			alert(spid+"==spid");
//			alert(evaluationcommodity+"==evaluationcommodity");
//			alert(jibie+"==jibie");
//			alert(oneID+"==oneID");
//			alert(yi+"==evaluationgrade");
				$.ajax({
					url:"http://localhost:16111/orderform/xingzpinl",
					mimeType: "post",
					data:{
						orderid:orderid1,
						userid:userid,
						spid:spid,
						evaluationgrade:yi,
						evaluationcommodity:evaluationcommodity,
//						plid:plid,
						jibie:jibie,
						oneID:oneID
						
					},
					xhrFields:{withCredentials: true},
					dataType:"json",
					success:function(date){
						if(date==1){
							alert("评论成功");
							location="udai_order.html";
						}
					},
					error:function(){
						alert("meiyou");
					}
				});
			}
</script>



</html>